import * as dotenv from 'dotenv'
import * as schedule from 'node-schedule'
import { Afunv } from './afunv'
dotenv.config({ path: `${__dirname}/.env` })

const checkInTask = () => {
    const afunv = new Afunv()
    afunv.login().then(()=>{
        afunv.checkIn().catch((e:Error) => console.error(e.message))
    }).catch((e:Error) => console.error(e.message))
}

console.log(new Date(), '挂载自动签到任务')
schedule.scheduleJob('0 0 8 * * *', ()=>{
    console.log(new Date(), '执行自动签到任务')
    checkInTask()
})

checkInTask()